public class Main {
    public static void main(String[] args) {
        String str = "123";
        int num = foo(str);
        num++;
        System.out.println(num);// 124
    }

    public static  int foo(String str)
    {
        int num=0;
        for (int i = 0; i < str.length(); i++) {

            char c=str.charAt(i);
            num=num*10+(c-'0');
        }
        return  num;
    }
}